const mongoose = require("mongoose")
const crypto = require("crypto") //引用加密模块
const ObjectId = mongoose.Schema.Types.ObjectId;
const EvaluationSchema = new mongoose.Schema({
    // 评价
    order: [{    //订单，消费的是服务，还是商品
        type: ObjectId,
        ref: "Service" //服务
    }, {
        type: ObjectId,
        ref: "Goods"  //商品
    }],
    stores: {  //服务,在那个门店进行消费
        type: ObjectId,
        ref: "Stores"
    },
    money: Number, //订单价格
    number: String, //评分
    content: String, //评价内容
    img: String,  //上传图片
    nature: String, //评价性质 正常、纠纷、刷单、水贴
    people: String,  //评价人
}, {
        versionKey: false,
        timestamps: {
            createdAt: 'createTime',
            updatedAt: 'updateTime'
        } //自动管理修改时间
    })
const evaluation = mongoose.model("evaluation", EvaluationSchema);

module.exports = evaluation;